<?php
class Tools{
	
	static public function link_to_css($css){
		if($_SERVER['HTTP_HOST']=='localhost'){
			$t = explode('/', $_SERVER['REQUEST_URI']);
			$path = '"';
			$path .= '/'.$t[1].'/view/'.$css;
			$path .= '"';
			return $path;
		}
		else{
			if($_SERVER['HTTPS'] == 'on') {
				$temp = 'https://';}
			else {
				$temp = 'http://';	}
			$path = '"';
			$path .= $temp.$_SERVER['HTTP_HOST'].'/view/'.$css;
			$path .= '"';
			return $path;
		}
	}
	
	
	static public function clear_url($url){
		$mit = array('á','é','í','ö','ő','ó','ü','ű','ú','Ö','Ü','Ó','Ő','Ú','É','Á','Ű','×');
		$mire = array('a','e','i','o','o','o','u','u','u','O','U','O','O','U','E','A','U','x');
		$newstr = str_replace($mit, $mire, $url);
		return $newstr;
	}
	
	static public function get_video($url='nothing', $width=250, $height=204){
		$temp1=explode('=', $url);
		$temp2=explode('&', $temp1[1]);
		if(($temp2[0]!="") && ($url!="")){
			$temp= '<iframe title="YouTube video player" width='.$width.' height='.$height.' src="http://www.youtube.com/embed/'.$temp2[0].'" frameborder="0" allowfullscreen></iframe>';
		}
		else{
			$temp= '<iframe title="YouTube video player" width='.$width.' height='.$height.' src="http://www.youtube.com/embed/'.$url.'" frameborder="0" allowfullscreen></iframe>';
		}
		return $temp;
	}
	
	static public function get_href($path){
		if($_SERVER['HTTP_HOST']=='localhost'){
			$t = explode('/', $_SERVER['REQUEST_URI']);
			if($_SERVER['HTTPS'] == 'on') {
				$temp = 'https://';}
			else {
				$temp = 'http://';}
		$temp .= $_SERVER['HTTP_HOST'].'/'.$t[1].$path;
		return $temp;
		}
		else{
		if($_SERVER['HTTPS'] == 'on'){
			$temp = 'https://';}
		else {
			$temp = 'http://';}
		$temp .= $_SERVER['HTTP_HOST'].'/'.$t[0].$path;
		return $temp;
		}
	}
}
?>